import React from "react";
import {TextField} from "@material-ui/core";
import {Autocomplete} from "@material-ui/lab";

export default function MenuSingleSelect({name, dataSource, itemName, handleChange}) {
  return (
    <Autocomplete
      options={dataSource}
      onChange={handleChange}
      value={itemName}
      getOptionLabel={(option) => option.name}
      renderInput={(params) => (
        <TextField
          {...params}
          variant="outlined"
          label={name}
          placeholder={`Search for ${name}...`}
        />
      )}
    />
  );
}
